#!/bin/bash
set -e
echo "Building file.."
echo "Approximate build time: 0.1 SBU"
echo "Required disk space: 18 MB"

# 5.21. File package contains a utility for determining the type of
# a given file or files
tar -xf /sources/file-*.tar.gz -C /tmp/ \
  && mv /tmp/file-* /tmp/file \
  && pushd /tmp/file \
  && ./configure --prefix=/tools \
  && make -j$(lscpu | grep '^CPU(s):' | awk '{print $2}') \
  && if [ $LFS_TEST -eq 1 ]; then make check; fi \
  && make install \
  && popd \
  && rm -rf /tmp/file
